#ifndef COMMONMESSAGE_H
#define COMMONMESSAGE_H

#include <QString>
#include <QDateTime>

enum MesSource{
    LocalPlayer = 101,
    FromServer = 201,
    FromClient = 202
};

enum MesType{
    UnKnownMesType = 0,
    ErrorMesType = 1,
    PlayerStateChange = 101,
    PlayerProgessChange = 102,
    PlayerMediaInfo = 103,
    PlayerProgess = 104,
    HeartBeat = 201,
    SimpleMessage = 202,
    NewConnection = 301,
    DisConnection = 302,
    ErrConnection = 303
};

class CommonMessage
{
public:
    CommonMessage(MesType type, QString msg);
    CommonMessage(MesType type, qint64 timestamp, QString msg);
    MesType type;
    qint64 timestamp;
    QString msg;
    static QString messageToString(CommonMessage msg);
    static QList<CommonMessage> stringToMessage(QString str);
};

#endif // COMMONMESSAGE_H
